// 调用nfc  xb xm gmsfhm mz dz qfjg yxqx
export const androidNfc = (zdbs, callback) => {
  if (android) {
    android.getNfcData(zdbs)
    window.setNfcData = (result) => {
      callback(JSON.parse(result))
    }
  }
}

// 调用ocr
export const androidOcr = (zdbs, callback) => {
  if (android) {
    android.getOcrData(zdbs)
    window.setOcrData = (result) => {
      callback(JSON.parse(result))
    }
  }
}

// 地图选点
export const androidMap = (zdbs, pointx, pointy, callback) => {
  console.log('x',pointx);
  console.log('y',pointy);
  
  if (android) {
    if (pointx) {
      android.getMapPoint(zdbs, pointx, pointy)
    } else {
      android.getMapPoint(zdbs)
    }
    window.setMapPoint = (resZdbs, pointx, pointy) => {
      callback(resZdbs, pointx, pointy)
    }
  }
}

// 调用扫码
export const androidScan = (zdbs,  callback) =>{
  if(android){
    android.getScanData(zdbs)
    window.setScanData = (result) =>{
      callback(JSON.parse(result))
    }
  }
}

// 跳转入户调查
export const androidRhdc = (dzysid) => {
  if (android) {
    android.enterHouse(dzysid)
  }
}

// 跳转层户结构
export const androidChjg = (dzysid) => {
  console.log('dzysid',dzysid);
  
  if (android) {
    android.enterFloor(dzysid)
  }
}

// 拨打电话
export const androidCall = (phoneNumber) => {
  // console.log('phoneNumber',phoneNumber);
  
  if (android) {
    android.makeACall(phoneNumber)
  }
}